{extend name="base" /}

{block name="content"}
<form class="layui-form layui-form-my" action="">
    <input type="hidden" value="{$Think.get.cps_id}" name="cps_id">
    <div class="layui-form-item">
        <label class="layui-form-label">渠道名称</label>
        <div class="layui-input-block">
            <input type="text" name="username" value="{$find.cps_name}" id="username" lay-verify="required" placeholder="请输入渠道名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">登录账号</label>
        <div class="layui-input-block">
            <input type="text" value="{$find.account}" disabled id="account" lay-verify="required|account" placeholder="4-16位（字母，数字，下划线，减号）组成" autocomplete="off" class="layui-input layui-disabled">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">登陆密码</label>
        <div class="layui-input-block">
            <input type="password" name="password" id="password" placeholder="为空不修改密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">确认密码</label>
        <div class="layui-input-block">
            <input type="password" name="password_confirm" id="password_confirm" placeholder="为空不修改密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">分成比例</label>
        <div class="layui-input-block">
            <input type="text" name="pay_rate" id="pay_rate" lay-verify="required|number" placeholder="请输入分成比例，%" value="{$find.pay_rate}" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea name="intro" id="intro" placeholder="请输入渠道备注，可不填" class="layui-textarea">{$find.intro}</textarea>
        </div>
    </div>
    <div class="layui-form-item" style="margin-bottom: 100px;">
        <div class="layui-input-block">
            <button class="layui-btn my-btn" lay-submit="" lay-filter="submitBtn">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary" style="color:#fff; border:none;">重置</button>
        </div>
    </div>
</form>
{/block}

{block name="css"}
{/block}

{block name="js"}
<script>
    layui.use(['form', 'element', 'jquery'], function(){
        var form = layui.form
            ,$ = layui.$
            ,layer = layui.layer;

        //提交
        form.on('submit(submitBtn)', function(data){
            var load = layer.load();
            $.post('{:url("ChannelSon/edit")}',data.field, function(json){
                layer.close(load);
                json.code==0 ? layer.msg(json.msg, {icon: 1, time: 1000}) : layer.msg(json.msg, {icon: 0, time: 1000});
            }, 'JSON');
            return false;
        });
    });
</script>
{/block}